package com.hzdl.car.util;

public class HzdlResultJson {
    private Integer code = 0;
    private String msg;
    private Object data;
    private Long count;

    public HzdlResultJson(Object data) {
        this.data = data;
        this.msg ="操作成功";
    }
    public HzdlResultJson(Long count,Object data) {
        this.count = count;
        this.data = data;
        this.msg ="操作成功";
    }
    public HzdlResultJson(Integer code, String message) {
        this.code = code;
        this.msg = message;
    }

    public HzdlResultJson( String msg, Object data) {
        this.msg = msg;
        this.data = data;
    }
    public HzdlResultJson( Integer code,String msg, Object data) {
        this.code=code;
        this.msg = msg;
        this.data = data;
    }

    public static HzdlResultJson ok(Object o){
        return  new HzdlResultJson(o);
    }
    public static HzdlResultJson ok(Long count,Object o){
        return  new HzdlResultJson(count,o);
    }

    public static HzdlResultJson error(Integer code, String message){
        return  new HzdlResultJson(code,message);
    }

    /**
     *
     * 关于CRUD操作的信息
     */
    public static HzdlResultJson ADD_SUCCESS(){
        return  new HzdlResultJson(Const.CODE_0,Const.ADD_SUCCESS);
    }
    public static HzdlResultJson ADD_FAIL(){
        return  new HzdlResultJson(Const.CODE_1,Const.ADD_FAIL);
    }


    public static HzdlResultJson UPDATE_SUCCESS(){
        return  new HzdlResultJson(Const.CODE_0,Const.UPDATE_SUCCESS);
    }
    public static HzdlResultJson UPDATE_FAIL(){
        return  new HzdlResultJson(Const.CODE_1,Const.UPDATE_FAIL);
    }


    public static HzdlResultJson DELETE_SUCCESS(){
        return  new HzdlResultJson(Const.CODE_0,Const.DELETE_SUCCESS);
    }
    public static HzdlResultJson DELETE_FAIL(){
        return  new HzdlResultJson(Const.CODE_1,Const.DELETE_FAIL);
    }


    public static HzdlResultJson DELETE_ALL_SUCCESS(){
        return  new HzdlResultJson(Const.CODE_0,Const.DELETE_ALL_SUCCESS);
    }
    public static HzdlResultJson DELETE_ALL_FAIL(){
        return  new HzdlResultJson(Const.CODE_1,Const.DELETE_ALL_FAIL);
    }

    public static HzdlResultJson DISTRIBUTE_SUCCESS(){
        return  new HzdlResultJson(Const.CODE_0,Const.DISTRIBUTE_SUCCESS);
    }
    public static HzdlResultJson DISTRIBUTE_FAIL(){
        return  new HzdlResultJson(Const.CODE_1,Const.DISTRIBUTE_FAIL);
    }


    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
